package com.le.tester.javaThink.fifth.chapter14_StreamingProgramming;

/**
 * 描述：java8方法引用
 */

interface Callable {
    void call(String s);
}

class Describe {
    void show(String msg) {
        System.out.println(msg);
    }
}

public class MethodReferences {
    static void hello(String name) {
        System.out.println("hello " + name);
    }

    static class Description {
        String about;

        public Description(String about) {
            this.about = about;
        }

        void help(String msg) {
            System.out.println(about + "" + msg);
        }
    }

    static class Helper {
        static void assist(String msg) {
            System.out.println();
        }
    }

    public static void main(String[] args) {

        Describe describe = new Describe();
        Callable c = describe::show;

        c.call("call()");

        c = MethodReferences::hello;
        c.call("Bod");

        c = new Description("valueHelp")::help;
        c.call("information");

        c = Helper::assist;
        c.call("help");
    }

}
